import unittest
import requests


class MyTestCase(unittest.TestCase):
    def test_something(self):
        '''v部落登录'''
        vdate={"username":"sang","password":123}
        head={"Content-Type":"application/x-www-form-urlencoded"}
        r=requests.post("http://182.92.178.83:8081/login",data=vdate,timeout=2,headers=head)
        #timeout 意思就是设置这个接口发送到服务器，服务器给我返回结果在2s内，如果超过这个时间就报错
        print(r.json())
        cc=r.json()
        print(cc['msg'])
        self.assertEqual(cc['msg'],"登录成功")


if __name__ == '__main__':
    unittest.main()
